package s3
import (
awsmiddleware
internalChecksum
s3cust
smithyhttp
)
func ( *Client) ( context.Context, *PutBucketPolicyInput, ...func(*Options)) (*PutBucketPolicyOutput, error) {
if == nil {
= &PutBucketPolicyInput{}
}
, , := .invokeOperation(, "PutBucketPolicy", , , .addOperationPutBucketPolicyMiddlewares)
if != nil {
return nil,
}
:= .(*PutBucketPolicyOutput)
.ResultMetadata =
return , nil
}
type PutBucketPolicyInput struct {
Bucket *string
Policy *string
ChecksumAlgorithm types.ChecksumAlgorithm
ConfirmRemoveSelfBucketAccess bool
ContentMD5 *string
ExpectedBucketOwner *string
noSmithyDocumentSerde
}
type PutBucketPolicyOutput struct {
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func ( *Client) ( *middleware.Stack, Options) ( error) {
= .Serialize.Add(&awsRestxml_serializeOpPutBucketPolicy{}, middleware.After)
if != nil {
return
}
= .Deserialize.Add(&awsRestxml_deserializeOpPutBucketPolicy{}, middleware.After)
if != nil {
return
}
if = addSetLoggerMiddleware(, ); != nil {
return
}
if = awsmiddleware.AddClientRequestIDMiddleware(); != nil {
return
}
if = smithyhttp.AddComputeContentLengthMiddleware(); != nil {
return
}
if = addResolveEndpointMiddleware(, ); != nil {
return
}
if = v4.AddComputePayloadSHA256Middleware(); != nil {
return
}
if = addRetryMiddlewares(, ); != nil {
return
}
if = addHTTPSignerV4Middleware(, ); != nil {
return
}
if = awsmiddleware.AddRawResponseToMetadata(); != nil {
return
}
if = awsmiddleware.AddRecordResponseTiming(); != nil {
return
}
if = addClientUserAgent(); != nil {
return
}
if = smithyhttp.AddErrorCloseResponseBodyMiddleware(); != nil {
return
}
if = smithyhttp.AddCloseResponseBodyMiddleware(); != nil {
return
}
if = swapWithCustomHTTPSignerMiddleware(, ); != nil {
return
}
if = addOpPutBucketPolicyValidationMiddleware(); != nil {
return
}
if = .Initialize.Add(newServiceMetadataMiddleware_opPutBucketPolicy(.Region), middleware.Before); != nil {
return
}
if = addMetadataRetrieverMiddleware(); != nil {
return
}
if = addPutBucketPolicyInputChecksumMiddlewares(, ); != nil {
return
}
if = addPutBucketPolicyUpdateEndpoint(, ); != nil {
return
}
if = addResponseErrorMiddleware(); != nil {
return
}
if = v4.AddContentSHA256HeaderMiddleware(); != nil {
return
}
if = disableAcceptEncodingGzip(); != nil {
return
}
if = addRequestResponseLogging(, ); != nil {
return
}
return nil
}
func ( string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: ,
ServiceID: ServiceID,
SigningName: "s3",
OperationName: "PutBucketPolicy",
}
}
func ( interface{}) (string, bool) {
:= .(*PutBucketPolicyInput)
if len(.ChecksumAlgorithm) == 0 {
return "", false
}
return string(.ChecksumAlgorithm), true
}
func ( *middleware.Stack, Options) error {
return internalChecksum.AddInputMiddleware(, internalChecksum.InputMiddlewareOptions{
GetAlgorithm: getPutBucketPolicyRequestAlgorithmMember,
RequireChecksum: true,
EnableTrailingChecksum: false,
EnableComputeSHA256PayloadHash: true,
EnableDecodedContentLengthHeader: true,
})
}
func ( interface{}) (*string, bool) {
:= .(*PutBucketPolicyInput)
if .Bucket == nil {
return nil, false
}
return .Bucket, true
}
func ( *middleware.Stack, Options) error {
return s3cust.UpdateEndpoint(, s3cust.UpdateEndpointOptions{
Accessor: s3cust.UpdateEndpointParameterAccessor{
GetBucketFromInput: getPutBucketPolicyBucketMember,
},
UsePathStyle: .UsePathStyle,
UseAccelerate: .UseAccelerate,
SupportsAccelerate: true,
TargetS3ObjectLambda: false,
EndpointResolver: .EndpointResolver,
EndpointResolverOptions: .EndpointOptions,
UseARNRegion: .UseARNRegion,
DisableMultiRegionAccessPoints: .DisableMultiRegionAccessPoints,
})
}